// Script File: weebly.js
// copy right 2009 TimAlosi.com
//
// This script file contains useful scripts for use with Weebly.
// Add this script file to the weebly Search Engine Optimization settings area in the footer script area.
//
// Usage in Weebly Footer
// <script type="text/javascript" src="http://timalosi-com.googlecode.com/svn/trunk/s/weebly.js"></script>
// <script type="text/javascript">
// remWeeblyFooter();
// addFavIcon("URL to ICO File", "URL to PNG File");
// googleAnalytics('UA-######');
// </script>


//-------------------------
// This section of code is always run
//-------------------------
// Add the request to load the Google Analytics Functions
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
// End of Common Code
//-------------------------




function addFavIcon(icoLink, pngLink) {
// Function addFavIcon
// copy right 2009 TimAlosi.com
//
// This function will add links into the <head> element to cause the browser to display
// a "favicon" for the page.  
//
// Two icon files should be created.  One with a .ico file type and one with a .png
// file type.  These types are prefered by different browsers.
//
// Usage
// <script type="text/javascript" src="http://timalosi-com.googlecode.com/svn/trunk/s/weebly.js"></script>
// <script type="text/javascript">
// addFavIcon("URL to ICO File", "URL to PNG File");
// </script>
//
// Example
// <script type="text/javascript">
// addFavIcon("http://timalosi-com.googlecode.com/svn/trunk/images/ta.ico","http://timalosi-com.googlecode.com/svn/trunk/images/ta.png");
// </script>
//
// Replace the two links above with urls to your icon files (or use mine)
//
//
//Debug Alerts
//alert ("in call 1");
//alert (icoLink);
//alert (pngLink);
var ico_ie = document.createElement('link');
ico_ie.setAttribute('rel', 'shortcut icon');
ico_ie.setAttribute('type', 'image/x-icon');
ico_ie.setAttribute('href', icoLink);
document.getElementsByTagName
('head')[0].appendChild(ico_ie);

var ico_ff = document.createElement('link');
ico_ff.setAttribute('rel', 'icon');
ico_ff.setAttribute('type', 'image/png');
ico_ff.setAttribute('href', pngLink);
document.getElementsByTagName
('head')[0].appendChild(ico_ff);

var ico_ip = document.createElement('link');
ico_ip.setAttribute('rel', 'apple-touch-icon');
ico_ip.setAttribute('href', pngLink);
document.getElementsByTagName
('head')[0].appendChild(ico_ip);

//debug alerts
//alert("exiting call");

}

function remWeeblyFooter () {
// Function remWeeblyFooter
// copy right 2009 TimAlosi.com
//
// This function will remove the banner in the footer that states that the website was
// created using weebly.
//
//
// Usage
// <script type="text/javascript" src="http://timalosi-com.googlecode.com/svn/trunk/s/weebly.js"></script>
// <script type="text/javascript">
// remWeeblyFooter();
// </script>
//
document.getElementById('weeblyFooter').innerHTML = '<br/>';

}

function googleAnalytics(sAnalyticsID) {
//
// Function googleAnalytics
// copy right 2009 TimAlosi.com
//
// This function will execute the Google Analytics page tracking code.
// parameter: sAnalyticsID is the tracking ID from your Google Analytics account
//
// Usage
// <script type="text/javascript" src="http://timalosi-com.googlecode.com/svn/trunk/s/weebly.js"></script>
// <script type="text/javascript">
// googleAnalytics('UA-######');
// </script>
//
//
try {
	var pageTracker = _gat._getTracker(sAnalyticsID);
	pageTracker._trackPageview();
} catch(err){};
}
